<template>
  <div class="card">
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: 'Card',
  data () {
    return {}
  }
}
</script>

<style lang="scss">
.card {
  margin: 0.8rem 0;
  background: #fff;
  border-radius: 6px;

  .card-header {
    position: relative;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: space-between;
    height: 2.4rem;
    background: #1e82d2;
    border-radius: 6px 6px 0 0;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    box-sizing: border-box;

    .card-header__title {
      position: relative;
      display: flex;
      flex-flow: row;
      align-items: center;
      justify-content: flex-start;
      font-size: 0.8rem;
      color: #fff;
      max-width: 80%;
    }
    .icon {
      color: #fff;
      font-size: 1.4rem;
      margin-right: 8px;
    }
    .card-header__icon {
      display: flex;
      flex-flow: row;
      align-items: center;
      font-size: 0.8rem;
      color: #fff;
    }
    .text {
      display: inline-block;
      overflow: hidden;
      width: 80%;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  &.success {
    .card-header {
      background: #2aab91;
    }
  }
  &.warning {
    .card-header {
      background: #fda470;
    }
  }
  &.danger {
    .card-header {
      background: #f56c6c;
    }
  }
  &.info {
    .card-header {
      background: #909399;
    }
  }

  .card-content {
    padding: 0.8rem;
    min-height: 3rem;
    line-height: 1.5;

    .grid {
      display: grid;
      grid-gap: 1px;
      grid-template-columns: 1fr 1fr;
      grid-auto-rows: minmax(1.6rem, auto);

      .grid-item {
        display: flex;
        flex-flow: row;
        font-size: 0.9rem;
        line-height: 1.6;

        &.h-full {
          grid-column: 1 / 3;
        }

        .label {
          width: 30%;
          min-width: 4rem;
        }
        .vlaue {
          display: block;
          flex: 1;
        }
      }
    }
  }

  .card-footer {
    position: relative;
    display: flex;
    flex-flow: row;
    align-items: center;
    justify-content: space-between;
    height: 2.4rem;
    border-radius: 0 0 6px 6px;
    padding-left: 0.8rem;
    padding-right: 0.5rem;
    box-sizing: border-box;

    &:before {
      content: '';
      position: absolute;
      top: -2px;
      left: 0.8rem;
      right: 0.8rem;
      height: 1px;
      background-color: #f5f5f5;
    }
    .card-footer__title {
      flex: 1;
      position: relative;
      display: flex;
      flex-flow: row;
      align-items: center;
      justify-content: flex-start;
      font-size: 0.8rem;
      color: #666;
      max-width: 80%;
    }
    .icon {
      color: #666;
      font-size: 1.4rem;
      margin-right: 8px;
    }
    .card-footer__icon {
      display: flex;
      flex-flow: row;
      align-items: center;
      font-size: 0.8rem;
      color: #666;
    }
    .text {
      display: inline-block;
      overflow: hidden;
      width: 80%;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

}
</style>


